{include file="public/head"/} 
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>停车记录管理中心</cite></a>
        <a><cite>停车记录管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so"  method="get" action="{url(admin/Record/recordList)}">
          <div class="layui-input-inline">
            <select name="out_parking_id" lay-filter="commname" id="commname">
              <option value="">所属停车场</option>
              {foreach $parkinglist as $parking}
              <option value="{$parking.out_parking_id}" {if isset($out_parking_id)}{if $out_parking_id == $parking.out_parking_id} selected {/if}{/if}>{$parking.parking_name}</option>
              {/foreach}
            </select>
          </div>
          <input type="text" name="car_number"  placeholder="车牌号码" autocomplete="off" class="layui-input" value="{if isset($where.car_number)}{$where.car_number}{/if}">
          <div class="layui-input-inline">
            <select name="status">
              <option value="">状态</option>
              <option value="1" {if isset($where.status)}{if $where.status == '1'}selected{/if}{/if}>停车中</option>
              <option value="2" {if isset($where.status)}{if $where.status == '2'}selected{/if}{/if}>已离场</option>
            </select>
          </div>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
	  <button class="layui-btn" onclick="recordDump('{$export}')"><i class="layui-icon"></i>批量导出</button></button>
        <!-- <button class="layui-btn" onclick="x_admin_show('添加停车场','{:url('admin/Parking/parkingAdd')}',700,680)"><i class="layui-icon"></i>添加停车场</button> -->
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <!-- <th style="text-align: center; font-size: 16px;">
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th> -->
            <th style="text-align: center; font-size: 16px;">ISV停车场ID</th>
            <th style="text-align: center; font-size: 16px;">区域名称</th>
            <th style="text-align: center; font-size: 16px;">停车场名称</th>
            <th style="text-align: center; font-size: 16px;">车牌号码</th>
            <th style="text-align: center; font-size: 16px;">入场时间</th>
            <th style="text-align: center; font-size: 16px;">出场时间</th>
            <th style="text-align: center; font-size: 16px;">停车时长</th>
            <th style="text-align: center; font-size: 16px;">状态</th>
          </tr>
        </thead>
        <tbody>
          {foreach $list as $lis}
          <tr>
            <!-- <td style="text-align: center;">
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
            </td> -->
            <td style="text-align: center;">{$lis.out_parking_id}</td>
            <td style="text-align: center;">{$lis.parking_name}</td>
            <td style="text-align: center;">{$lis.community_id}</td>
            <td style="text-align: center;">{$lis.car_number}</td>
            <td style="text-align: center;">{$lis.in_time}</td>
            <td style="text-align: center;">{$lis.out_time}</td>
            <td style="text-align: center;">{$lis.parking_time}分钟</td>
            <td style="text-align: center;">
              {if $lis.status == 1}
                  停车中
              {elseif $lis.status == 2}
                  已离场
              {/if}
            </td>
            <!-- <td class="td-manage" style="text-align: center;">
                {if $lis.status == 1}
                <a title="修改"  onclick="x_admin_show('修改','{:url('admin/Parking/parkingUpdate')}?id={$lis.id}',780,600)" href="javascript:;">
                  <i class="layui-icon">&#xe614;</i>
                </a>
                {elseif $lis.status ==2}
                  <a title="编辑"  onclick="x_admin_show('编辑','{:url('admin/Parking/parkingEdit')}?id={$lis.id}',780,600)" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                  </a>
                  <a title="上线"  onclick="parkingCreate('{$lis.id}',)" href="javascript:;">
                    <i class="layui-icon">&#xe609;</i>
                  </a>
                  <a title="删除" onclick="parkingDel('{$lis.id}', '{$lis.id}')" href="javascript:;" id="{$lis.id}">
                    <i class="layui-icon">&#xe640;</i>
                  </a>
                {/if}
            </td> -->
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
            {$recordlist->render()}
        </div>
      </div>

    </div>
    <script>

      //删除
      function parkingDel(id, doc){
        if(confirm('确定要删除吗?')) 
        { 
          var url = "{:url('parkingDel')}?id=" + id
          // console.log(url)
          $('#' + doc).attr('href', url)
        } 
          return false; 
      } 
      //同步上线
      function parkingCreate(id){
        if(confirm('确定要上线吗?')) {
          var url = '{:url("admin/Parking/parkingCreate")}'
          $.post(url, {id: id}, function(r){
              if (r.info) {
                alert(r.info)
              }else{
                location.reload()  
              }
          })
        }
      }
	  //批量导出
      function recordDump(exportid){
          var url = "{:url('admin/Record/recordExcel')}?&export=" + exportid;
          layer.open({
              type: 2,
              title: '批量导出账单',
              shadeClose: true,
              shade: 0.8,
              area: ['60%', '60%'],
              content: url //iframe的url
          });
      }


    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>